package com.zhiwang.xiaoqu.ui

import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.zhiwang.xiaoqu.R
import com.zhiwang.xiaoqu.widget.snap.CardAdapterHelper

open class TextWatcherAdapter : TextWatcher {
    override fun afterTextChanged(s: Editable?) {

    }

    override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {

    }

    override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {

    }
}


class RecommendTaskAdapter :
    RecyclerView.Adapter<RecommendTaskAdapter.RecommendViewHolder>() {
    var cardAdapterHelper : CardAdapterHelper? = null

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecommendViewHolder {
        val itemView = LayoutInflater.from(parent.context).inflate(R.layout.item_daily_recommend_task, parent, false)
        cardAdapterHelper?.onCreateViewHolder(parent, itemView)
        return RecommendViewHolder(itemView)
    }

    override fun getItemCount() = 6

    override fun onBindViewHolder(holder: RecommendViewHolder, position: Int) {
        cardAdapterHelper?.onBindViewHolder(holder.itemView, position, itemCount)
        holder.recyclerView.adapter = TaskStatusAdapter()
    }


    class RecommendViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

        val recyclerView = itemView.findViewById<RecyclerView>(R.id.status_recyclerView)

    }
}

class TaskStatusAdapter : RecyclerView.Adapter<TaskStatusAdapter.StatusViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): StatusViewHolder {
        return StatusViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_task_status, parent, false))
    }

    override fun getItemCount() = 5

    override fun onBindViewHolder(holder: StatusViewHolder, position: Int) {

    }


    class StatusViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

    }
}